#ifndef _CCLI_FLAG_H_
#define _CCLI_FLAG_H_

typedef enum{
    CCLIFlagTypeInt,
    CCLIFlagTypeBool,
}CCLIFlagType;

typedef struct{
    char *shortName;
    char *longName;
    char *description;

    //buf need size
    void *data;
    int dataSize;
    CCLIFlagType type;
}CcliFlag;

struct _ccli_flag_list_;
typedef struct _ccli_flag_list_ CCLIFlagList;
struct _ccli_flag_list_{
    CcliFlag entry;
    CCLIFlagList *next;
};

typedef struct{
    CCLIFlagList *head;
    CCLIFlagList *tail;
}CCLIFlagHandler;

//CCLIFlagHandlerInit: init
CCLIFlagHandler *CCLIFlagHandlerInit();

//CCLIFlagSetInt not support reset
int CCLIFlagSetInt(CCLIFlagHandler *handler, int *var, char *shortName, char *longName, int defaultVar, char *description);

//Bool do not need arg
int CCLIFlagSetBool(CCLIFlagHandler *handler, int *var, char *shortName, char *longName, int defaultVar, char *description);


//CCLIFlagParse: parse flag and return the not parsed argv
//stop parse when meet unset flag, or meet the word is not flag
int CCLIFlagParse(CCLIFlagHandler *handler, int *argc, char ***argv);

#endif